package com.guchenbo.example.io;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;

/**
 * @author guchenbo
 * @date 2022/4/30
 */
public class FileTest {
    public static void main(String[] args) throws IOException {
        File file = new File("/tmp/filedemo");
        assert file.exists() || file.createNewFile();
        FileOutputStream stream = new FileOutputStream(file);
        List<String> books = BookUtils.getBooks();

        for (int i = 0; i < books.size(); i++) {
            if (i == 100) {
                break;
            }
            stream.write(books.get(i).getBytes());
        }
    }
}
